/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package framework.view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

/**
 *
 * @author ThanhNguyen
 */
public class EntryDialog extends AbstractDialog {

    private double amount;

    public double getAmount() {
        return amount;
    }

    public EntryDialog(String title, String customerName) {
        setLayout(null);
        setTitle(title);
        setSize(268, 140);
        setModal(true);
        setResizable(false);
        JLabel label1 = new JLabel("Name");
        label1.setBounds(12, 12, 48, 24);
        add(label1);
        JLabel label2 = new JLabel("Amount");
        label2.setBounds(12, 48, 48, 24);
        add(label2);
        final JTextField txtName = new JTextField(customerName);
        txtName.setBounds(84, 12, 144, 24);
        txtName.setEditable(false);
        add(txtName);
        final JTextField txtAmount = new JTextField();
        txtAmount.setBounds(84, 48, 144, 24);
        add(txtAmount);
        JButton btnOK = new JButton("OK");
        btnOK.setBounds(36, 84, 84, 24);
        btnOK.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                amount = Double.parseDouble(txtAmount.getText());
                OK = true;
                dispose();
            }
        });
        add(btnOK);
        JButton btnCancel = new JButton("Cancel");
        btnCancel.setBounds(156, 84, 84, 24);
        btnCancel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                dispose();
            }
        });
        add(btnCancel);
    }

    @Override
    public void initComponents() {
    }
}
